/**
 * @title deploy VRFCoordinatorV2Mock
 */
const { devlopmentChains } = require("../helper-hardhat-config")
const { network, ethers } = require("hardhat")

module.exports = async (hre) => {
    const { getNamedAccounts, deployments } = hre
    const { deploy, log } = deployments
    const { deployer } = await getNamedAccounts() //获取部署合约的私钥地址

    const args = [ethers.utils.parseEther("0.25"), 1e9] //baseGas = 0.25Link ,价格波动范围1e9
    if (devlopmentChains.includes(network.name)) {
        log("devlopmentChain detected..")
        await deploy("VRFCoordinatorV2Mock", {
            from: deployer,
            log: true,
            args: args,
        })
        log("VRFmock is deployed")
        log("-------------------------------")
    }
    await deploy("MockV3Aggregator", {
        from: deployer,
        log: true,
        args: ["18", "2000000000000000000000"], //初始价格和小数位
    })
}

module.exports.tags = ["all", "vrfmocks"]
